#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/rope>
#define rep(i,l,r) for(int i=(l),i##end=(r);i<=i##end;++i)
#define per(i,r,l) for(int i=(r),i##end=(l);i>=i##end;--i)
#define int long long
#define double long double
#define pii pair<int,int>
#define fi first
#define se second
#define pb push_back
#define rbtree(way) tree<way,null_type,less<way>,rb_tree_tag,tree_order_statistics_node_update>
using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;
const int maxn=1e6+10,maxm=1e6+10,mod=998244353,inf=INT_MAX;
inline int ksm(int x,int k,int mod=mod){
	int ans=1;
	for(;k;k>>=1,x=x*x%mod) if(k&1) ans=ans*x%mod;
	return ans;
}

int n,mx,cnt,a[maxn];

signed main(){
	freopen("palindrome.in","r",stdin),freopen("palindrome.out","w",stdout);
	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	cin>>n;
	rep(i,1,n) cin>>a[i];
	sort(a+1,a+n+1);
	do{
		int nw=n;
		rep(l,1,n) rep(r,l+1,n) if(a[l]==a[r]&&a[l+1]==a[r-1]){
			++nw;
			rep(k,l+2,l+r>>1) if(a[k]!=a[l+r-k]) --nw,k=kend;
		}
		if(nw>mx) mx=nw;
		if(nw==mx) ++cnt;
	}while(next_permutation(a+1,a+n+1));
	cout<<mx<<" "<<cnt;
	return 0;
}/*
10
1 2 3 4 5 6 7 8 9 10

*/
